package com.boss.core;

/**
 * This class is used to get some details from the http connection
 * during the remote job triggering process via http POST.
 *
 * @author Momin Noor Khan
 */

public class BossResponse {
    private int responseCode;
    private String exceptionMsg;
    private String stackTraceElement;


    public BossResponse() { }

    public BossResponse(int responseCode, String exceptionMsg) {
        this.responseCode = responseCode;
        this.exceptionMsg = exceptionMsg;
    }

    public BossResponse(int responseCode) {
        this.responseCode = responseCode;
    }

    /**
     * Gets the value of response code
     * (HttpURLConnection's response code is meant here).
     *
     * @return
     */
    public int getResponseCode() {
        return responseCode;
    }

    /**
     * Set the response code.
     * (HttpURLConnection's response code is meant here).
     *
     * @param responseCode
     */
    public void setResponseCode(int responseCode) {
        this.responseCode = responseCode;
    }

    /**
     * Gets the message that is supposed to contain the description of the exception if any.
     *
     * @return
     */
    public String getExceptionMsg() {
        return exceptionMsg;
    }

    /**
     * Sets the message when an exception occurred.
     * (It is supposed to be set when the HttpURLConnection is not OK)
     *
     * @param exceptionMsg
     */
    public void setExceptionMsg(String exceptionMsg) {
        this.exceptionMsg = exceptionMsg;
    }

    /**
     * Gets the complete stack trace from the exception if any.
     * To-Do : Not working as expected. Needs more thorough analysis.
     *
     * @return
     */
    public String getStackTraceElement() {
        return this.stackTraceElement;
    }

    /**
     * Sets the value of stack trace element by populating it with the data from the exception if any.
     *
     * @param stackTraceElement
     */
    public void setStackTraceElement(String stackTraceElement) {
        this.stackTraceElement = stackTraceElement;
    }
}
